import React, { useState } from 'react';
import store from '../redux/store';
import {useNavigate} from 'react-router-dom';
function City(){
    const navigate = useNavigate()
    const [list]=useState(['北京','上海','广州','深圳','南昌'])
    return (
        <div>
            City
            <ol>
                {
                    list.map(item=><li key={item} onClick={()=>{
                        store.dispatch({    //通知
                            type:"change-city",
                            citys:item
                        })
                        //通知完了跳转回去
                        navigate("/cinemas")
                    }}>{item}</li>)
                }
            </ol>
        </div>
    );
}

export default City